// 路由表




const constantRouterMap = [
  // ************* 前台路由 **************
  {
    path: '/',
    redirect: '/index'
  },
  {
    path: '/index',
    name: 'index',
    redirect: '/index/portal',
    component: () => import('/@/views/index/index.vue'),
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import('/@/views/index/login.vue')
      },
      {
        path: 'register',
        name: 'register',
        component: () => import('/@/views/index/register.vue')
      },
      {
        path: 'portal',
        name: 'portal',
        component: () => import('/@/views/index/portal.vue')
      },
      {
        path: 'detail',
        name: 'detail',
        component: () => import('/@/views/index/detail.vue')
      },
      {
        path: 'confirm',
        name: 'confirm',
        component: () => import('/@/views/index/confirm.vue')
      },
      {
        path: 'pay',
        name: 'pay',
        component: () => import('/@/views/index/pay.vue')
      },
      {
        path: 'search',
        name: 'search',
        component: () => import('/@/views/index/search.vue')
      },
      {
        path: 'usercenter',
        name: 'usercenter',
        redirect: '/index/usercenter/addressView',
        component: () => import('/@/views/index/usercenter.vue'),
        children: [
          {
            path: 'addressView',
            name: 'addressView',
            component: () => import('/@/views/index/user/address-view.vue')
          },
          {
            path: 'wishThingView',
            name: 'wishThingView',
            component: () => import('/@/views/index/user/wish-thing-view.vue')
          },
          {
            path: 'collectThingView',
            name: 'collectThingView',
            component: () => import('/@/views/index/user/collect-thing-view.vue')
          },
          {
            path: 'jiajiaoEditView',
            name: 'jiajiaoEditView',
            component: () => import('/@/views/index/user/jiajiao-edit-view.vue')
          },
          {
            path: 'userInfoEditView',
            name: 'userInfoEditView',
            component: () => import('/@/views/index/user/userinfo-edit-view.vue')
          },
          {
            path: 'followView',
            name: 'followView',
            component: () => import('/@/views/index/user/follow-view.vue')
          },
          {
            path: 'fansView',
            name: 'fansView',
            component: () => import('/@/views/index/user/fans-view.vue')
          },
          {
            path: 'scoreView',
            name: 'scoreView',
            component: () => import('/@/views/index/user/score-view.vue')
          },
          {
            path: 'commentView',
            name: 'commentView',
            component: () => import('/@/views/index/user/comment-view.vue')
          },
          {
            path: 'securityView',
            name: 'securityView',
            component: () => import('/@/views/index/user/security-view.vue')
          },
          {
            path: 'pushView',
            name: 'pushView',
            component: () => import('/@/views/index/user/push-view.vue')
          },
          {
            path: 'messageView',
            name: 'messageView',
            component: () => import('/@/views/index/user/message-view.vue')
          },
        ]
      }
    ]
  },
  {
    path: '/adminLogin',
    name: 'adminLogin',
    component: () => import('/@/views/admin/admin-login.vue'),
  },
  {
    path: '/admin',
    name: 'admin',
    redirect: '/admin/thing',
    component: () => import('/@/views/admin/main.vue'),
    children: [
      { path: 'overview', name: 'overview', component: () => import('/@/views/admin/overview.vue') },
      { path: 'order', name: 'order', component: () => import('/@/views/admin/order.vue') },
      { path: 'thing', name: 'thing', component: () => import('/@/views/admin/thing.vue') },
      { path: 'comment', name: 'comment', component: () => import('/@/views/admin/comment.vue') },
      { path: 'user', name: 'user', component: () => import('/@/views/admin/user.vue') },
      { path: 'classification', name: 'classification', component: () => import('/@/views/admin/classification.vue') },
      { path: 'tag', name: 'tag', component: () => import('/@/views/admin/tag.vue') },
      { path: 'ad', name: 'ad', component: () => import('/@/views/admin/ad.vue') },
      { path: 'notice', name: 'notice', component: () => import('/@/views/admin/notice.vue') },
      { path: 'loginLog', name: 'loginLog', component: () => import('/@/views/admin/login-log.vue') },
      { path: 'opLog', name: 'opLog', component: () => import('/@/views/admin/op-log.vue') },
      { path: 'errorLog', name: 'errorLog', component: () => import('/@/views/admin/error-log.vue') },
      { path: 'sysInfo', name: 'sysInfo', component: () => import('/@/views/admin/sys-info.vue') },
      
    ]
  },
  // {
  //   path: '/chat',
  //   children: [
  //     {
  //       path: 'list',
  //       name: 'ChatList',
  //       component: () => import('/@/views/index/components/ChatList.vue')
  //       .catch(() => { // 捕获加载错误<button class="citation-flag" data-index="5">
  //         console.error('ChatList加载失败');
  //         return { template: '<div>加载失败</div>' };
  //       })
  //     },
  //     {
  //       path: ':targetId',
  //       name: 'ChatBox',
  //       component: () => import('/@/views/index/components/ChatBox.vue'),
  //       props: true
  //     }
  //   ]
  // },
  // {
    


      // {
      //   path: '/list',
      //   name: 'ChatList',
      //   component: () => import('/@/views/index/components/ChatList.vue')
      // },
      // {
      //   path: '/chatbox/:targetId',
      //   name: 'ChatBox',
      //   component: () => import('/@/views/index/components/ChatBox.vue'),
      //   props: true
      // }
      {
        path: '/chat/:targetUserId',
        name: 'ChatBox',
        component: () => import('/@/views/index/components/ChatBox.vue'),
        props: true // 启用路由参数自动传递为props
      },

      {
        path: '/teacher',
        name: 'main_th',
        component: () => import('/@/views/teacher/main_th.vue'),
        meta: { requiresAuth: true }
      },
      {
        path: '/teacher/login',
        name: 'teacherLogin',
        component: () => import('/@/views/teacher/login_th.vue')
      },
      {
        path: '/order',
        name: 'order',
        component: () => import('/@/views/index/user/order-view.vue')
      },

      {
        path: '/teacher',
        component: () => import('/@/views/teacher/main_th.vue'),
        children: [
          {
            path: 'sure',
            name: 'sure',
            component: () => import('/@/views/teacher/CourseList_th.vue'),
            meta: { title: '待确认课程' }
          },
          {
            path: 'will',
            name: 'will',
            component: () => import('/@/views/teacher/CourseList_th.vue'),
            meta: { title: '即将开始' }
          },
          {
            path: 'ing',
            name: 'ing',
            component: () => import('/@/views/teacher/CourseList_th.vue'),
            meta: { title: '进行中' }
          },
          {
            path: 'over',
            name: 'over',
            component: () => import('/@/views/teacher/CourseList_th.vue'),
            meta: { title: '已结束' }
          },
          {
            path: 'canceled',
            name: 'canceled', 
            component: () => import('/@/views/teacher/CourseList_th.vue'),
            meta: { title: '已取消课程' }
          },
          {
            path: '/teacher/finance',
            name: 'finance',
            component: () => import('/@/views/teacher/FinanceView.vue')
          },
          {
            path: 'info',
            name: 'courseManage',  // 对应菜单的key
            component: () => import('/@/views/teacher/Info_th.vue'),
            meta: { title: '信息管理' }
          },
          {
            path: 'publish',
            name: 'publish',
            component: () => import('/@/views/teacher/HomeworkPublish.vue')
          },
          {
            path: 'record', // 已发布作业列表
            name: 'record',
            component: () => import('/@/views/teacher/HomeworkList.vue')
          },
          {
            path: 'correct/:id', // 批改具体作业
            name: 'correct',
            component: () => import('/@/views/teacher/HomeworkCorrect.vue')
          },
          {
            path: '/teaching-analysis',
            name: 'teachingAnalysis',
            component: () => import('/@/views/teacher/TeachingAnalysis.vue'),
            meta: { title: '教学分析' }
          }
        ]
      },
      // {
      //   path: '/aichat',
      //   name: 'aichat',
      //   component: () => import('/@/components/AiChat.vue')
      // },
      // {
      //   path: 'publish',
      //   name: 'publish',
      //   component: () => import('/@/views/teacher/PublishHomework.vue'),
      //   meta: { title: '发布作业' }
      // },
      // {
      //   path: 'record',
      //   name: 'record',
      //   component: () => import('/@/views/teacher/HomeworkList.vue'),
      //   meta: { title: '已发布作业' }
      // },
      // {
      //   path: 'correct/:homeworkId',
      //   name: 'correct',
      //   component: () => import('/@/views/teacher/CorrectHomework.vue'),
      //   meta: { title: '作业批改' }
      // }


];


export default constantRouterMap;
